﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using YArchitech.Revit;

namespace YArchitech.HVAC.AuxiliaryCurve
{
	public class ElementSelection : AuxiliarySelection
	{
		public ElementSelection(ExternalCommandData cmd)
		{
			this.m_cmd = cmd;
			this.sel = this.m_cmd.Application.ActiveUIDocument.Selection;
		}

		public override bool Select()
		{
			Document document = this.m_cmd.Application.ActiveUIDocument.Document;
			ISelectionFilter selectionFilter = new WallAndFloorAndCeilAndRefPlaneSelectionFilter();
			Reference reference = this.sel.PickObject((Autodesk.Revit.UI.Selection.ObjectType)1, selectionFilter, "请选择墙或者楼板或者参照平面");
			base.SelectElement = document.GetElement(reference);
			base.SelectPoint = reference.GlobalPoint;
			return true;
		}
	}
}
